<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>后台管理</title>
    <link rel="stylesheet" href="./public/layui/css/layui.css">
    
</head>

<body>
    <div class="container layui-padding-4">
        <form class="layui-form layui-form-pane" action="" lay-filter="config">
            <fieldset class="layui-elem-field">
                <legend>基本配置</legend>
                <div class="layui-field-box">
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">公告</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入公告" name="new" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">公告开关</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="new_switch" lay-skin="switch" lay-filter="switchTest"
                                title="ON|OFF">
                        </div>
                    </div>
                    <hr>
                    <div class="layui-form-item layui-form-text">
                        <label class="layui-form-label">版本更新</label>
                        <div class="layui-input-block">
                            <textarea placeholder="请输入版本更新内容" name="update_new" class="layui-textarea"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">当前版本</label>
                        <div class="layui-input-inline">
                            <input type="text" name="version" lay-verify="required" placeholder="请输入当前版本"
                                autocomplete="off" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">下载链接</label>
                        <div class="layui-input-inline">
                            <input type="text" name="downloadLink" placeholder="请输入App下载链接" autocomplete="off"
                                class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">反馈开关</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="feedback" lay-skin="switch" lay-filter="switchTest"
                                title="ON|OFF" checked>
                        </div>
                    </div>
                </div>
            </fieldset>
            <fieldset class="layui-elem-field">
                <legend>登录</legend>
                <div class="layui-field-box">
                    <div class="layui-form-item">
                        <label class="layui-form-label">开关</label>
                        <div class="layui-input-block">
                            <input type="checkbox" name="is_log" lay-skin="switch" lay-filter="switchTest"
                                title="ON|OFF">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">送金币</label>
                        <div class="layui-input-inline">
                            <div class="layui-input-inline">
                                <input type="number" lay-verify="required" lay-affix="number" name="log_send_score"
                                    placeholder="积分" step="10" min="0" class="layui-input" value="0">
                            </div>
                        </div>
                    </div>
                </div>
            </fieldset>

            <fieldset class="layui-elem-field">
                <legend>签到</legend>
                <div class="layui-field-box">
                    <div class="layui-form-item">
                        <label class="layui-form-label">开关</label>
                        <div class="layui-input-inline">
                            <input type="checkbox" name="is_sign" lay-skin="switch" lay-filter="switchTest"
                                title="ON|OFF">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">连续签到</label>
                        <div class="layui-input-inline">
                            <input type="text" name="sign_three" lay-verify="required" placeholder="连续签到 3天 积分"
                                autocomplete="off" class="layui-input">
                            <span class="layui-font-blue layui-font-12">签到<strong>小于</strong> 3天 积分</span>
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="sign_seven" lay-verify="required" placeholder="连续签到 7天 积分"
                                autocomplete="off" class="layui-input">
                            <span class="layui-font-blue layui-font-12">连续签到 7天 积分</span>
                        </div>
                        <div class="layui-input-inline">
                            <input type="text" name="sign_fifteen" lay-verify="required" placeholder="连续签到 15天 积分"
                                autocomplete="off" class="layui-input">
                            <span class="layui-font-blue layui-font-12">连续签到 15天 积分</span>
                        </div>
                    </div>
                </div>
            </fieldset>



            <div class="layui-form-item">
                <div class="layui-input-block">
                    <button type="submit" class="layui-btn" lay-submit lay-filter="submit">Submit</button>
                </div>
            </div>
        </form>
    </div>


    <{include file="common/bottom.html" }>


        <script>
            layui.use(function () {
                var form = layui.form
                var layer = layui.layer
                form.val('config', {
                     'is_log': "<{$config.is_log}>" == 0 ? false : true
                    , 'update_new': "<{$config.update_new}>"
                    , 'new': "<{$config.new}>" 
                    , 'new_switch': "<{$config.new_switch}>"  == 0 ? false : true
                    , 'is_sign': "<{$config.is_sign}>"  == 0 ? false : true
                    , 'version': "<{$config.version}>" 
                    , 'feedback': "<{$config.feedback}>"  == 0 ? false : true
                    , 'log_send_score': "<{$config.log_send_score}>"
                    , 'downloadLink': "<{$config.downloadLink}>"
                    , 'sign_three': "<{$config.sign_three}>"
                    , 'sign_seven': "<{$config.sign_seven}>"
                    , 'sign_fifteen': "<{$config.sign_fifteen}>"
                })
                form.on('submit(submit)', (data) => {
                    field = data.field
                    $.post('?p=index&c=config&a=set', field, (res) => {
                        if (res.code == 200) {
                            layer.msg('配置成功')
                        } else {
                            layer.msg(res.msg)
                        }
                    })
                    return false
                })
            })
        </script>